package com.me.chat.controller.bis;

import com.me.chat.service.UploadService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@Slf4j
@RestController
@RequestMapping("/res/upload")
public class UploadController {

    @Autowired
    UploadService uploadService;


    /**
     * 用户头像更新
     * @param multipartFile
     * @param userId
     */
    @PostMapping("/avatarUpload")
    public void avatarUpload(MultipartFile multipartFile,String userId){
        try {
            uploadService.avatarUpload(multipartFile, userId);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
